#!/usr/bin/env php
<?php
/**
 * Compact PHP code.
 *
 * Strip comments, combine entire library into one file.
 */

if ($argc < 3) {
  print "Strip unecessary data from PHP source files.\n\n\tUsage: php CleanLine.php DESTINATION.php SOURCE.php";
  exit;
}


$source = $argv[2];
$target = $argv[1];
print "Clean `$source` into `$target`.\n\n";

$string = '';
$lines = file($source);
foreach($lines as $li){
	$li = rtrim($li);
	if($li == ''){
		$li = '';
	}
	if($li){
		$string .= $li. "\r\n";
	}
}

file_put_contents($target, "<?". "php\n\n" .trim($string, '\x1A\n\r\0\t'). "\n\n?".">");


?>